package com.hnd.springframework.beans.factory.support;

import com.hnd.springframework.beans.factory.config.SingletonBeanRegistry;


import java.util.HashMap;
import java.util.Map;

/**
 * 单例工厂注册器
 *
 * @author hnd
 */
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {
    /**
     * 单例模式注册表
     */
    private Map<String, Object> singletonMap = new HashMap<>();

    @Override
    public Object getSingleton(String beanName) {
        return singletonMap.get(beanName);
    }

    protected void addSingleton(String beanName, Object bean) {
        singletonMap.put(beanName, bean);

    }
}
